<?php
class Attachment_Model extends CI_Model
{
    public $name;
    public $operator_id;
    public $url;
    public $ext;


    function __construct()
    {
        $this->setTableName("attachment");
        parent::__construct();
    }

    function findImages($count)
    {
        $this->setQuery($this->db
            ->where_in('ext', array("gif", "jpg", "png"))
            ->order_by("id","desc")
            ->limit($count)->get($this->getTableName()));
        return $this->mappingList();
    }

    public function getOperatoer()
    {
        $this->load->model("Article_Model");
        $this->Article_Model->id = $this->getOperatorId();
        return $this->Article_Model->load();
    }

    public function setExt($ext)
    {
        $this->ext = $ext;
    }

    public function getExt()
    {
        return $this->ext;
    }

    public function setName($name)
    {
        $this->name = $name;
    }

    public function getName()
    {
        return $this->name;
    }

    public function setOperatorId($operator_id)
    {
        $this->operator_id = $operator_id;
    }

    public function getOperatorId()
    {
        return $this->operator_id;
    }

    public function setUrl($url)
    {
        $this->url = $url;
    }

    public function getUrl()
    {
        return $this->url;
    }


    /**
     * 查询pid 为0 分类
     */

}